package com.newbsd.web.maventest.service.impl;
/**
 * @author 张成玉 LoginServiceImpl
 */
import java.sql.SQLException;
import java.util.List;
import com.newbsd.web.maventest.dao.LoginDao;
import com.newbsd.web.maventest.pojo.User;
import com.newbsd.web.maventest.service.LoginService;

public class LoginServiceImpl implements LoginService{

	private LoginDao loginDao;
	
	public LoginServiceImpl() {
		loginDao = new LoginDao();
	}
	
	@Override
	public User login(String username, String password) {
		try {
			List<User> list = loginDao.login(username, password);
			//张成玉-根据返回值进行选择判断
			if(list!=null && list.size()>0){
				return list.get(0);
			}else {
				return null;
			}
		} catch (SQLException e) {
			return null;
		}
	}

}
